// zoj2963
// 题意：给定n(<=500)个点，m条边（无重边，自环，每条边也有花费时间）的
//       无向图，每个点有怪，已知每个点击败怪的时间，现在有k个点有宝藏
//       （不超过15个），给定起点和终点，问收集完宝藏最少总花费是多少。
//       当你离开一个点后，这个点的怪物会重新刷新。
//
// 题解：我们发现，因为怪物会重新刷新，所以每次我们都是从一个宝藏点或
//       起点终点走向另一个宝藏点或起点终点，所以我们先用宝藏点以及起
//       点终点在原图跑最多17次dijkstra，然后把原图压缩成了17个点的图。
//       接下来我们只需要设dp[state][i]表示当前经过了state表示的这些点，
//       已i结尾最小花费。然后不断转移，最后dp[111..11B][exit]就是答案。
//
//       明明可以用向量表示，为什么要用map...
//
// run: time -p $exec < bfdiff.in
#include <iostream>
#include <queue>
#include <utility>
#include <algorithm>
#include <vector>

int const maxn = 507;
int const maxm = maxn * maxn * 2;
int head[maxn], end_point[maxm], next[maxm];
int cost[maxm];
int alloc = 2;
int beat[maxn];
int n, m, tn, t, in, out;

std::vector<int> dist[maxn];
std::vector<int> pos;

void add_edge(int u, int v, int c)
{
	end_point[alloc] = v; cost[alloc] = c;
	next[alloc] = head[u]; head[u] = alloc++;

	end_point[alloc] = u; cost[alloc] = c;
	next[alloc] = head[v]; head[v] = alloc++;
}

int constexpr inf = 1 << 23;

void dijkstra(int source, int id)
{
	dist[id].resize(n + 1);
	std::fill(dist[id].begin(), dist[id].end(), inf);
	dist[id][source] = 0;
	using cost_end = std::pair<int, int>;
	std::priority_queue<cost_end, std::vector<cost_end>, std::greater<cost_end> > pq;
	pq.push(std::make_pair(0, source));
	while (!pq.empty()) {
		cost_end tmp = pq.top(); pq.pop();
		int u = tmp.second;
		if (dist[id][u] < tmp.first) continue;

		for (int p = head[u]; p; p = next[p]) {
			auto v = end_point[p];
			auto c = cost[p] + beat[v - 1];
			if (dist[id][v] > dist[id][u] + c) {
				dist[id][v] = dist[id][u] + c;
				pq.push(std::make_pair(dist[id][v], v));
			}
		}
	}
}

using pair_type = std::pair<int, int>;
std::queue<pair_type> q;
int constexpr maxtn = 18;
int constexpr max_state = 1 << maxtn;
int dis[max_state][maxtn];
int map[maxtn][maxtn];

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> n) {
		alloc = 2;
		for (int i = 0; i <= n; i++) head[i] = 0;
		for (int i = 0; i < n; i++)
			std::cin >> beat[i];
		std::cin >> t;
		pos.resize(t);
		for (int i = 0; i < t; i++) std::cin >> pos[i];
		std::sort(pos.begin(), pos.end());
		auto last = std::unique(pos.begin(), pos.end());
		pos.erase(last, pos.end());

		std::cin >> m;
		for (int i = 0, x, y, z; i < m; i++) {
			std::cin >> x >> y >> z;
			add_edge(x, y, z);
		}
		std::cin >> in >> out;
		for (auto it = pos.begin(); it != pos.end(); )
			if (*it == in || *it == out)
				it = pos.erase(it);
			else
				++it;
		tn = pos.size();

		for (int i = 0; i < tn; i++)
			dijkstra(pos[i], i);
		dijkstra(in, tn);
		dijkstra(out, tn + 1);

		for (int i = 0; i <= tn + 1; i++) {
			for (int j = 0; j <= tn + 1; j++) map[i][j] = inf;
			map[i][i] = 0;
		}
		for (int i = 0; i < tn; i++) {
			for (int j = 0; j < tn; j++) {
				if (i == j) continue;
				map[i][j] = dist[i][pos[j]];
			}
			map[i][tn] = dist[i][in];
			map[tn][i] = dist[tn][pos[i]];
			map[i][tn + 1] = dist[i][out];
			map[tn + 1][i] = dist[tn + 1][pos[i]];
		}
		map[tn][tn + 1] = dist[tn][out];
		map[tn + 1][tn] = dist[tn + 1][in];

		for (int i = 0; i <= (1<<(tn+2)) - 1; i++)
			for (int j = 0; j < tn + 2; j++) dis[i][j] = -1;

		pair_type tmp(1 << tn, tn);
		q.push(tmp);
		dis[tmp.first][tmp.second] = 0;
		while (!q.empty()) {
			auto now = q.front(); q.pop();
			for (int i = 0; i <= tn + 1; i++) {
				if (now.first & (1 << i)) continue;
				int t1 = now.first | (1 << i);
				auto tdis = dis[now.first][now.second] + map[now.second][i];
				if (dis[t1][i] == -1) {
					q.push({t1, i});
					dis[t1][i] = tdis;
				} else
					dis[t1][i] = std::min(dis[t1][i], tdis);
			}
		}
		std::cout << dis[(1 << (tn + 2)) - 1][tn + 1] + beat[in - 1] << '\n';
	}
}

